<?php
//指定商城父分类下的所有子分类并树状格式化后的结果
class cache_supplier_location_menu_cate_auto_cache extends auto_cache{

	public function load($param)
	{
		$key = $this->build_key(__CLASS__,$param);
		$GLOBALS['fcache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
		$menu_cate_list = $GLOBALS['fcache']->get($key);
		if($menu_cate_list===false)
		{
			$supplier_location_id=$param['id'];
			$menu_cate_list =  $GLOBALS['db']->getAll("SELECT cate_id FROM ".DB_PREFIX."supplier_location_menu WHERE is_special=0 and supplier_location_id=".$supplier_location_id." and cate_id>=35 GROUP BY cate_id order by cate_id desc");
			foreach($menu_cate_list as $k=>$v)
			{		
				$menu_cate_new=$GLOBALS['db']->getRow("SELECT * FROM ".DB_PREFIX."supplier_location_menu_cate WHERE is_delete = 0 and is_effect=1 and id=".intval($v['cate_id'])."");
				$menu_cate_list[$k]['name']=$menu_cate_new['name'];
				if($menu_cate_new['brief'] !="")
					$menu_cate_list[$k]['title']=$menu_cate_new['brief'];
				else
					$menu_cate_list[$k]['title']=$menu_cate_new['name'];
			}	
			$GLOBALS['fcache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
			$GLOBALS['fcache']->set($key,$menu_cate_list);
		}
		return $menu_cate_list;
	}
	public function rm($param)
	{
		$key = $this->build_key(__CLASS__,$param);
		$GLOBALS['fcache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
		$GLOBALS['fcache']->rm($key);
	}
	public function clear_all()
	{
		$GLOBALS['fcache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
		$GLOBALS['fcache']->clear();
	}
}
?>